﻿using System;
using System.IO;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace System.IO
{
    public static class StreamHelpers
    {
        public static void CopyTo(this Stream Src, Stream Dest, int bufferSize)
        {
            var buffer = new byte[bufferSize];
            int readLen = 0;
            int readBytes = 0;
            do
            {
                readLen = Src.Read(buffer, readBytes, bufferSize);
                Dest.Write(buffer, readBytes, readLen);
                Dest.Flush();
                readBytes += readLen;
            } while (readLen > 0);
        }
    }
}